package com.example.forumsystem.demos.web.exception;

import com.example.forumsystem.demos.web.model.Result;
import org.apache.logging.log4j.message.ReusableMessage;

//自定义异常
public class ApplicationException extends RuntimeException{
    private Result errorResult;

    public ApplicationException(Result errorResult) {
        this.errorResult = errorResult;
    }

    public ApplicationException(String message, Result errorResult) {
        super(message);
        this.errorResult = errorResult;
    }

    public ApplicationException(String message, Throwable cause, Result errorResult) {
        super(message, cause);
        this.errorResult = errorResult;
    }

    public ApplicationException(Throwable cause, Result errorResult) {
        super(cause);
        this.errorResult = errorResult;
    }

    public ApplicationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Result errorResult) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.errorResult = errorResult;
    }

    public Result getErrorResult() {
        return errorResult;
    }
}
